<%@page import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	BarForm form = (BarForm)request.getAttribute("command");
	UserInfo user = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
	String username = user.getName();
%>

<div>
	<form id="BarAddForm" target="_coreIframe" method="post" action="<%=request.getContextPath()%>/bar/doAdd" enctype="multipart/form-data">
		<div class="breadcrumb">
			<div class="bcIcon"></div>
			<ul class="bcNav">
				<li>注册巴枪</li>
			</ul>
		</div>
		<table class="formTable">
			<tr>
				<td class="tdTitle">巴枪编号：</td>
				<td>
					<input class="inputText xs" type="text"  value="" name="deviceid">
					<span class="errorTipWrap" id="errorTip_deviceid"></span>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">巴枪厂商：</td>
				<td><input class="inputText xs" type="text"  value="" name="companyName"></td>
			</tr>
			<tr>
				<td class="tdTitle">站点：</td>
				<td>
					<select id="siteList" class="inputText xs" name="siteid">
						<option></option>
					</select>				
				</td>
			</tr>
			<tr>
				<td class="tdTitle">备注：</td>
				<td><input class="inputText xs" type="text"  value="" name="remark">
			</tr>
			<input type="hidden" value="<%=username %>" name="addUser"> 
			<tr>
				<td class="tdTitle"></td>
				<td>
					<div>
						<input class="input-btn-microsoft" type="submit" value="提交">
						<a class="a-btn-microsoft" href="">取消</a>
					</div>
				</td>
			</tr>	
		</table>
	</form>
	<iframe id="_coreIframe" name="_coreIframe" style="display: none;"></iframe>
</div>
<script type="text/javascript">
	$("input[name=deviceid]").focus();
	$("#siteList").select2({
		language: "zh-CN",
	    minimumInputLength: 1,
	    ajax: {
	        url: global.contextPath +"/bar/sites",
	        dataType: "json",
	        type: "GET",
	        data: function (params) {
	            var queryParameters = {
	                term: params.term
	            }
	            return queryParameters;
	        },
	        processResults: function (data) {
	            return {
	                results: $.map(data, function (item) {
	                    return {
	                        text: item.text,
	                        id: item.id
	                    }
	                })
	            };
	        }
	    }
	});
</script>



